/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Trabalho3.RegrasPasswordChecker02;

import Trabalho3.RuleFactory;

/**
 *
 * @author geraldo
 */
public class RegraDescontoSequenciaSimbolos implements RuleFactory{
    String password;

    public RegraDescontoSequenciaSimbolos(String password) {
        this.password = password;
    }
    
    
    @Override
    public int calcularRegra() {
       String simbolos = new Simbolos().getSIMBOLOS();
       int qtdeSeqSimbolos =0;
           for (int s=0; s < 8; s++) {//<==== Simbolos sequenciais
			String sFwd = simbolos.substring(s,s+3);
			String sRev = new StringBuffer(sFwd).reverse().toString();
			if (password.toLowerCase().indexOf(sFwd) != -1 || password.toLowerCase().indexOf(sRev) != -1) { 
                            qtdeSeqSimbolos++;
                        }
		}
       return qtdeSeqSimbolos*-1; 
   } }

